package com.caogen.cg_wl_kt.config

import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor

/**
 * 项目名称: cg_wl_kt
 * Packages:com.caogen.cg_wl_kt.config
 * author: FSW
 * 创建日期: 2024/2/26 09:49
 * Describe:
 *
 */
object Config {
    const val IS_DEBUG = true

    const val URL:String = "http://caogenwl.chengxin56.net/" // 正式站

    var _client: OkHttpClient? = null

    @JvmStatic
    fun getClient(): OkHttpClient {
        if (null == _client) {
            _client = OkHttpClient.Builder().addInterceptor(getLoggingInterceptor()).build()
        }
        return _client!!
    }

    var _loggingInterceptor: HttpLoggingInterceptor? = null
    fun getLoggingInterceptor(): HttpLoggingInterceptor {
        if (null == _loggingInterceptor) {
            _loggingInterceptor = HttpLoggingInterceptor()
        }
        if (IS_DEBUG) {
            _loggingInterceptor!!.level = HttpLoggingInterceptor.Level.BODY
        } else {
            _loggingInterceptor!!.level = HttpLoggingInterceptor.Level.NONE
        }
        return _loggingInterceptor!!
    }

}